<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_CodeFunc.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: 농협전북지부 ERP시스템 ::</title>
<link href="../css/layout.css" type="text/css" rel="stylesheet" />
<link type="text/css" href="/css/hot-sneaks/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/js/print_excel.js"></script>
<script type="text/javascript">
$(function(){
	// Datepicker
	$('#sdate').datepicker({
		inline: true,
		showOn: 'button',
		buttonImage:"/img/ico_cal.jpg",
		buttonImageOnly: true
	});
	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); },
		function() { $(this).removeClass('ui-state-hover'); }
	);
	$('#edate').datepicker({
		inline: true,
		showOn: 'button',
		buttonImage:"/img/ico_cal.jpg",
		buttonImageOnly: true
	});
});
</script>
<script type="text/javascript">
	function fnchkradio(v)
	{
		if (v=="1")
		{
			$("#sdate").val($.getDateAdd(0, "D"));
			$("#edate").val($.getDateAdd(0, "D"));
		}
		if (v=="2")
		{
			$("#sdate").val($.getDateAdd(-7, "D"));
			$("#edate").val($.getDateAdd(0, "D"));
		}
		if (v=="3")
		{
			$("#sdate").val($.getDateAdd(-1, "M"));
			$("#edate").val($.getDateAdd(0, "D"));
		}
	}

	function search()
	{
		if ($("#sdate").val()=="")
		{
			alert("검색 시작일을 입력하세요");
			$("#sdate").focus();
			return;
		}
		if ($("#edate").val()=="")
		{
			alert("검색 종료일을 입력하세요");
			$("#edate").focus();
			return;
		}
		document.theForm.submit();
	}
	$.extend({
		getDateAdd: function(number, dateType){
			var today = new Date();
			var dateAdd = "";
			number = parseInt(number);
			switch (dateType){
				case "Y" :
					dateAdd = new Date(today.setYear(today.getFullYear() + number));
					break;
				case "M" :
					dateAdd = new Date(today.setMonth(today.getMonth() + number));
					break;
				case "D" :
					dateAdd = new Date(today.setDate(today.getDate() + number));
					break;
			}
			return dateAdd.getFullYear() + "-" + $.addZero(dateAdd.getMonth() + 1) + "-" + $.addZero(dateAdd.getDate());
		},
		addZero: function(number){
			return parseInt(number) < 10 ? "0" + number : number;
		}
	});
	$(document).ready(function(){
		if ($("#item1").val()!="")
		{
			fncGetItemJSON('item', 2, $("#item1").val(), $('#item2'));
		}
	});
</script>
</head>

<body>
<div id="wrap">
<!-- header start -->
<? include("../_layout/head.inc"); ?>
<!-- header end -->

<!-- search start -->
<? include("./item_search.php"); ?>
<!-- search end -->

<!-- container start -->
	<div id="container">
    	<div class="subtit">
        	<p class="subtt05"><span>조회 > 입고리스트</span></p>
		</div>
        <div class="contents">
        	<p class="tableTitle"><span class="b"></span>조회</p>
			<form name="theForm" id="theForm" method="post" action="item_check_in.html">
			<input type="hidden" name="menu1" id="menu1" value="<?=$menu1?>" />
			<input type="hidden" name="menu2" id="menu2" value="<?=$menu2?>" />
        	<table cellpadding="0" cellspacing="1" border="0" class="erpTable sTB">
            	<tr>
                	<th>조회기간</th>
                    <td colspan="5" >
                    	<input type="radio" id="ochk" name="ochk" value="1" title="일" onclick="fnchkradio(this.value)" <?if ($ochk==1){?>checked<?}?> /><span class="txt_radio">일</span>
                        <input type="radio" id="ochk" name="ochk" value="2" title="주" onclick="fnchkradio(this.value)" <?if ($ochk==2){?>checked<?}?> /><span class="txt_radio">주</span>
                        <input type="radio" id="ochk" name="ochk" value="3" title="월" onclick="fnchkradio(this.value)" <?if ($ochk==3){?>checked<?}?> /><span class="txt_radio">월</span>
						<input type="radio" id="ochk" name="ochk" value="4" title="기간" <?if ($ochk==4){?>checked<?}?> /><span class="txt_radio">기간</span>
                    	<input type="text" id="sdate" name="sdate" value="<?=$sdate?>" title="발주일입력/달력을클릭해주세요." readonly class="boxinput w100" style="margin-right:2px;vertical-align:top;" /> ~
                    	<input type="text" id="edate" name="edate" value="<?=$edate?>" title="발주일입력/달력을클릭해주세요." readonly class="boxinput w100" style="margin-right:2px;vertical-align:top;" />
                    </td>
                    <th></th>
                    <td></td>
				</tr>
                <tr>
                	<th>품목</th>
                    <td>
                    	<select	name="jseq" id="jseq">
							<option value="">농협명</option>
							<?
								$codedata = & JBNH_GetSelect(0);
								JBNH_PrintOption($codedata, $jseq);
							?>
                        </select>
                    </td>
                    <td>
                    	<select name="item1" id="item1" onchange="fncGetItemJSON('item', 2, this.value, $('#item2'));">
                        	<option value="">품목</option>
							<?
								$codedata = & Code_GetSelect("A", 1, 0,false);
								Code_PrintOption($codedata, 1, $item1);
							?>
                        </select>
                    </td>
                    <td>
                    	<select name="item2" id="item2">
                        	<option value="">품종</option>
                        </select>
						<input type="hidden" name="oitem2" id="oitem2" value="<?=$item2?>" />
                    </td>
                    <td>
                    	<select name="oworkyn" id="oworkyn">
                        	<option value="" <?=($oworkyn=="")?"selected":""?>>선별여부</option>
							<option value="Y" <?=($oworkyn=="Y")?"selected":""?>>유</option>
							<option value="N" <?=($oworkyn=="N")?"selected":""?>>무</option>
                        </select>
                    </td>
                    <td>
						<input type="hidden" name="ograde1" id="ograde1" value="2" />
                    	<select name="ograde2" id="ograde2">
                        	<option value="">등급</option>
							<?
								$codedata = & Code_GetSelect("B", 2, 2,false);
								Code_PrintOption($codedata, 2, $ograde2);
							?>
                        </select>
                    </td>
                    <td>
						<input type="hidden" name="ostandard1" id="ostandard1" value="3" />
                    	<select name="ostandard2" id="ostandard2">
                        	<option value="">규격</option>
							<?
								$codedata = & Code_GetSelect("B", 2, 3,false);
								Code_PrintOption($codedata, 2, $ostandard2);
							?>
                        </select>
                    </td>
                    <td>
  						<input type="hidden" name="oweight1" id="oweight1" value="1" />
                    	<select name="oweight2" id="oweight2">
                        	<option value="">중량</option>
							<?
								$codedata = & Code_GetSelect("B", 2, 1,false);
								Code_PrintOption($codedata, 2, $oweight2, "KG");
							?>
                        </select> kg
                    </td>
                </tr>
            </table>
            <div class="BtnList">
            	<ul>
                	<li><input type="button" class="btn_inquiry" onclick="search()" title="조회"/></li>
                </ul>
            </div>
			</form>
            <p class="tableTitle"><span class="b"></span>입고리스트</p>
			<div class="BtnList2">
				<input type="button" class="btn_excel" onClick="MNG.fncRtnfunc('excel');" title="엑셀로다운받기"/>
                <input type="button" class="btn_print" onClick="MNG.fncRtnfunc('print');" title="출력하기"/>
			</div>
			<p class="searchDate">조회기간 : <span><?=$sdate?> ~ <?=$edate?></span> 까지 입고된 리스트 입니다.</p>
			<input type="hidden" name="printtitle" id="printtitle" value="입고리스트" />
            <table cellpadding="0" cellspacing="1" border="0" class="erpTable" id="printtable">


            	<tr>
                	<th>등록일자</th>
                    <th>농협명</th>
                    <th>품목</th>
                    <th>품종</th>
                    <th>선별여부</th>
                    <th>등급</th>
                    <th>규격</th>
                    <th>중량</th>
                    <th>수량</th>
                    <th>합계</th>
					<th>입고확인증</th>
				</tr>
<!-- list start -->
<? include("./item_check_in_list.php"); ?>
<!-- list end -->
                <tr>
                	<td colspan="12" class="total">합계 : <?=number_format($sum)?> Kg </td>
                </tr>
            </table>
        </div>
    </div>
<!-- footer start -->
<? include("../_layout/footer.inc"); ?>
<!-- footer end -->
</div>
</body>
</html>
